package net.lukecloud.xile.util.Mico;

import android.content.Context;

import io.fogcloud.sdk.easylink.api.EasyLink;
import io.fogcloud.sdk.easylink.helper.EasyLinkCallBack;
import io.fogcloud.sdk.easylink.helper.EasyLinkParams;
import io.fogcloud.sdk.mdns.api.MDNS;
import io.fogcloud.sdk.mdns.helper.SearchDeviceCallBack;

/**
 * Created by jmy on 2017/8/1.
 */

public class MicoKit {
    private EasyLink micoeasylink;
    private MDNS micomdns;
    //	private MiCOSocket micosocket;
    private Context mContext = null;

    public MicoKit(EasyLink micoeasylink, MDNS micomdns, Context mContext) {
        this.micoeasylink = micoeasylink;
        this.micomdns = micomdns;
        this.mContext = mContext;
    }

    /**
     * Get ssid.
     * @return
     */
    public String getSSID() {
        if (null != mContext) {
            return micoeasylink.getSSID();
        }
        return null;
    }

    public void startEasyLink(EasyLinkParams easylinkPara, EasyLinkCallBack easylinkcb) {
        if (null != mContext) {
            micoeasylink.startEasyLink(easylinkPara, easylinkcb);
        }
    }
    public void stopEasyLink(EasyLinkCallBack easylinkcb){
        micoeasylink.stopEasyLink(easylinkcb);
    }

    public void startSearchDevices(String serviceName, SearchDeviceCallBack searchdevcb) {
        if (null != mContext){
            micomdns.startSearchDevices(serviceName, searchdevcb);
        }
    }

    /**
     * Stop search devices.
     * @param searchdevcb searchdevcb
     */
    public void stopSearchDevices(SearchDeviceCallBack searchdevcb) {
        micomdns.stopSearchDevices(searchdevcb);
    }

}
